//
//  MyUISearchBar.m
//  TestVacasolAPIs
//
//  Created by Dang Quang Trung on 8/7/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "MyUISearchBar.h"

@implementation MyUISearchBar

- (void)layoutSubviews {
    UITextField *searchField;
    NSUInteger numViews = [self.subviews count];
    for(int i = 0; i < numViews; i++) {
        
        if([[self.subviews objectAtIndex:i] isKindOfClass:[UITextField class]]) { //conform?
            searchField = [self.subviews objectAtIndex:i];
        }
    }
    
    if(!(searchField == nil)) {
        //searchField.textColor = [UIColor whiteColor];
        [searchField setBackground: [UIImage imageNamed:@"input.png"] ];
        [searchField setBorderStyle:UITextBorderStyleNone];
    }
    for (UIView *view in self.subviews)
    {
        if ([view isKindOfClass:NSClassFromString
             (@"UISearchBarBackground")])
        {
            [view removeFromSuperview];
            break;
        }
    }
    [self setShowsCancelButton:NO animated:NO];
    

        [super layoutSubviews];
}


@end
